package cn.bdqn.study_method_param;

import java.util.Scanner;

//学生管理类测试
public class StudentBizImpl {
    public static void main(String[] args) {
        StudentBiz sb = new StudentBiz();
        Scanner input = new Scanner(System.in);
        for (int i = 1; i <= 5; i++) {
            System.out.println("请输入第"+i+"名同学的姓名：");
            String name = input.next();
            sb.addName(name);
        }
        sb.showNames();

//        System.out.println("请输入要查找的开始位置：");
//        int begin = input.nextInt();
//        System.out.println("请输入要查找的结束位置：");
//        int end = input.nextInt();
//        System.out.println("请输入要查找的学生姓名：");
//        String name = input.next();
//        boolean b = sb.selectNameByIndex(begin, end, name);
//        System.out.println("该姓名在指定区间内是否存在："+b);


        System.out.println("请输入旧名字：");
        String oldName = input.next();
        System.out.println("请输入新名字：");
        String newName = input.next();
        boolean b = sb.updateName(oldName, newName);
        if(b){
            System.out.println("修改成功！");
        }else{
            System.out.println("修改失败！");
        }
        System.out.println("修改后学生姓名如下：");
        sb.showNames();
    }

}
